#!/usr/bin/perl -w
use strict;
use warnings;
use DBI;

require('function.pl');
require('config.pl');

my $db_conn = DBI->connect("DBI:mysql:database=phone_num_search;host=$ENV{'db_host'}", $ENV{'db_user'}, '');
$db_conn->do('set names utf8');
open IN, 'data/tag_results' or die("fail	open data/tag_results\n");
while (<IN>) {
	chomp;
	my @arr = split("\t");
	next if (@arr < 4);
	my $sql = "update result set keyword$arr[0] = '$arr[3]' where phone_num = '$arr[1]' and rank = $arr[2]";
	$db_conn->do($sql);
}
close IN;

